package com.ruoyi.system.artrec.controller;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.artrec.service.ArtRecService;
import com.ruoyi.system.model.domain.ArtRec;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @other pzz
 * @data 2024/8/23
 * @apiNote
 */
@RestController
@RequestMapping("/art/rec")
public class ArtRecController extends BaseController {
    @Autowired
    private ArtRecService artRecService;

    @GetMapping("/list")
    public TableDataInfo list(ArtRec artRec) {
        startPage();
        artRec.setSaleCode("JYM");
        return getDataTable(artRecService.selectArtRecList(artRec));
    }

    @PutMapping
    public AjaxResult update(@RequestBody ArtRec artRec) {
        return toAjax(artRecService.update(artRec));
    }

    @PostMapping
    public AjaxResult add(@RequestBody ArtRec artRec) {
        return toAjax(artRecService.insert(artRec));
    }

    /**
     * 删除用户填报
     */
    @Log(title = "用户填报", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(artRecService.delete(ids));
    }
}
